<!DOCTYPE html>

<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
	<title>vant-由www.magicalcoder.com可视化布局器生成</title>
	<link href="https://cdn.jsdelivr.net/npm/vant@2.5/lib/index.css" rel="stylesheet" />
	<link href="http://www.magicalcoder.com/magicaldrag/assets/drag/ui/magicalcoder/1.1.0/magicalcoder.css" rel="stylesheet" />
	<link href="example.css" rel="stylesheet" />
	<link href="js/viewer.min.css" rel="stylesheet" />
	<!-- 如果要兼容ie8及以前版本 请打开注释-->
	<!-- <script src="http://www.magicalcoder.com/assets/ui/element/2.10.1/browser.min.js"></script><script src="http://www.magicalcoder.com/assets/ui/element/2.10.1/browser-polyfill.min.js"></script>-->
	<script src="js/json3.min.js"></script>
	<script src="js/echarts.min.js"></script>
	<script src="js/dataTool.min.js"></script>
	<script src="js/vue.min.js"></script>
	<script src="js/axios.min.js"></script>
	<script src="https://cdn.jsdelivr.net/npm/vant@2.6/lib/vant.min.js"></script>
	<script src="http://www.magicalcoder.com/assets/js/common.js"></script>
	<script src="http://www.magicalcoder.com/magicaldrag/assets/drag/ui/magicalcoder/1.1.0/magicalcoder.js"></script>
	<script src="js/viewer.min.js"></script>
	<script src="example.js"></script>
	<script src="service.js"></script>
	<script src="common.js"></script>

	<style>

	</style>

</head>
<body style="background-color:#F0F2F5 !important">
	<div id="magicalDragScene" class="mc-root">
		<template>
			<van-tabs @change="SampLingImgLoad">
				<van-tab title="基本信息">
					<van-collapse v-model="activeNames">
						<van-collapse-item name="1" title="基本信息" size="large">
							<van-field v-model="SampForm.SamplingNo" placeholder="系统自动生成" label="采样单编号" disabled></van-field>
							<van-field v-model="SampForm.ProjectName" label="监测任务" disabled></van-field>
							<van-field v-model="Montype.text" placeholder="监测性质" right-icon="arrow-down" label="监测性质" disabled></van-field>
							<div>
								<van-field readonly clickable label="采样日期:" :value="SampForm.SamplingTimeBegin" placeholder="采样日期" required
								 @click="showSamplingcalendar=true"></van-field>
								<van-calendar v-model="showSamplingcalendar" type="single" @confirm="SamplingBeginTimeConfirm" input-align="center"></van-calendar>
							</div>
							<div>
								<van-field readonly clickable label="样品性质" :value="SampForm.TagName" required placeholder="请选择" @click="showTagIdPicker=true"
								 right-icon="arrow-down"></van-field>
								<van-popup v-model="showTagIdPicker" round position="bottom">
									<van-picker show-toolbar :columns="TagIds" @cancel="showTagIdPicker = false" @confirm="TagIdConfirm"></van-picker>
								</van-popup>
								<van-field readonly clickable label="监测点位" :value="SampForm.AddressName" required placeholder="监测点位" @click="showAddressPicker=true"
								 right-icon="arrow-down"></van-field>
								<van-popup v-model="showAddressPicker" round position="bottom">
									<van-picker show-toolbar :columns="addresses" @cancel="showAddressPicker = false" @confirm="AddressConfirm"></van-picker>
								</van-popup>
								<van-field readonly clickable label="采样方法" :value="SampForm.MethodName" placeholder="请选择" @click="showMethodPicker=true"
								 right-icon="arrow-down"></van-field>
								<van-popup v-model="showMethodPicker" round position="bottom">
									<van-picker show-toolbar :columns="MethodIds" @cancel="showMethodPicker = false" @confirm="MethodConfirm"></van-picker>
								</van-popup>
								<van-field readonly clickable label="天气" :value="SampForm.Weather" placeholder="请选择" @click="showWeatherPicker=true"
								 right-icon="arrow-down"></van-field>
								<van-popup v-model="showWeatherPicker" round position="bottom">
									<van-picker show-toolbar :columns="Weathers" @cancel="showWeatherPicker = false" @confirm="WeatherConfirm"></van-picker>
								</van-popup>
							</div>
							<van-field v-model="SampForm.Temprature" placeholder="气温" type="number" label="气温(°C)"></van-field>
							<van-field v-model="SampForm.Pressure" type="number" placeholder="气压" label="气压(kPa)"></van-field>
							<van-field v-model="PrivateData.HandleDevice" placeholder="处理设施" label="处理设施"></van-field>
							<van-field v-model="PrivateData.ClientName" placeholder="企业名称" label="企业名称"></van-field>
							<van-field v-model="PrivateData.ClientAdd" placeholder="企业地址" label="企业地址"></van-field>
							<div>
								<van-field readonly clickable label="是否进入管网" :value="PrivateData.AccessPipeNetwork" placeholder="是否进入管网" @click="show_AccessPipeNetwork_Picker=true"
								 right-icon="arrow-down"></van-field>
								<van-popup v-model="show_AccessPipeNetwork_Picker" round position="bottom">
									<van-picker show-toolbar :columns="AccessPipeNetwork" @cancel="show_AccessPipeNetwork_Picker = false" @confirm="AccessPipeNetworkConfirm"></van-picker>
								</van-popup>
							</div>
							<div>
								<van-field readonly clickable label="建设时间" :value="PrivateData.BuildTime" placeholder="请选择日期" @click="showBuildTimecalendar=true"></van-field>
								<van-calendar v-model="showBuildTimecalendar" type="single" @confirm="BuildTimecalendarConfirm" input-align="center"
								 color="#009688"></van-calendar>
							</div>
						</van-collapse-item>
						<van-collapse-item name="2" title="样品流转信息" size="large">
							<van-field v-model="SampForm.Transfer" placeholder="运输方式" label="运输方式"></van-field>
							<van-field readonly clickable label="送样时间" :value="SampForm.SendSampTime" placeholder="请选择日期" @click="SendSampTimePicker=true"></van-field>
							<van-calendar v-model="SendSampTimePicker" type="single" @confirm="SendSampTimeConfirm" input-align="center"
							 color="#009688"></van-calendar>
							<van-field v-model="SampForm.ReciveTime" placeholder="收样时间" label="收样时间" disabled></van-field>
						</van-collapse-item>
						<van-collapse-item name="3" title="采样信息" size="large">
							<van-divider>采样信息</van-divider>
							<van-button @click="createSamp">新增</van-button>
							<!--toSmapInfo(item)-->
							<t-protable v-for="(item,index) in sampDetail" @touchstart.native="gtouchstart(item)" @click.native="toSmapInfo(item,index)"
							 :key="item" v-bind:pro="item" v-bind:sampindex="index"></t-protable>
							<!-- 采样信息详情 -->
							<div>
								<van-popup v-model="showSamplinginfo" v-if="samplingObj.Row" closeable position="bottom" :style="{ height: '100%' }">
									<van-field style="margin-top:30px" v-model="samplingObj.Row.SampingCode" readonly placeholder="由系统生成" label="样品编码"></van-field>
									<van-field v-model="samplingObj.Row.FrequecyNo" readonly placeholder="由系统生成" label="频次" type="digit"></van-field>
									<div>
										<van-field readonly clickable label="选择时间" :value="samplingObj.Row.SamplingTime" placeholder="请选择" @click="SamplingTimePicker=true"
										 right-icon="arrow-down"></van-field>
										<van-popup v-model="SamplingTimePicker" round position="bottom">
											<van-datetime-picker title="选择时间" v-model="currentTime" type="time" @confirm="SamplingTimeConfirm"></van-datetime-picker>
										</van-popup>
									</div>
									<van-field v-model="samplingObj.Row.SamplingType" placeholder="无" label="质控" disabled></van-field>
									<div>
										<van-field readonly clickable label="监测项目" :value="common.sampformat(samplingObj.sampling)" placeholder="请选择"
										 @click="tomonpicker(samplingObj,false)" right-icon="arrow-down"></van-field>
									</div>
									<div>
										<van-field readonly clickable label="现场测定项目" :value="common.sampformat(samplingObj.samplingsence)"
										 placeholder="请选择" @click="tomonpicker(samplingObj,true)" right-icon="arrow-down"></van-field>
									</div>


									<van-field v-model="samplingObj.Row.SamplingCount" placeholder="0" label="样品瓶数" type="number"></van-field>
									<div>
										<van-field readonly clickable label="添加保存剂" :value="samplingObj.Row.Preservative" placeholder="是否添加保存剂"
										 @click="PreservativePicker=true" right-icon="arrow-down"></van-field>
										<van-popup v-model="PreservativePicker" round position="bottom">
											<van-picker show-toolbar :columns="Preservatives" @cancel="PreservativePicker = false" @confirm="PreservativeConfirm"></van-picker>
										</van-popup>
									</div>
									<div>
										<van-field readonly clickable label="对比监测" :value="samplingObj.Row.IsCompare?'是':'否'" placeholder="对比监测"
										 @click="IsComparePicker=true" right-icon="arrow-down"></van-field>
										<van-popup v-model="IsComparePicker" round position="bottom">
											<van-picker show-toolbar :columns="IsCompares" @cancel="IsComparePicker = false" @confirm="IsCompareConfirm"></van-picker>
										</van-popup>
									</div>
									<van-field v-model="samplingObj.Row.SampleCollection" placeholder="样品采集" label="样品采集"></van-field>
									<van-field v-model="samplingObj.Row.SampleAcceptance" placeholder="样品验收" label="样品验收"></van-field>
									<van-field v-model="samplingObj.Row.Description" placeholder="备注" label="备注"></van-field>
								</van-popup>
							</div>
						</van-collapse-item>


						<van-collapse-item name="4" title="备注信息" size="large">
							<!-- <van-field v-model="SampForm.Comment"></van-field> -->
							<div contenteditable="true" v-html="SampForm.Comment">{{SampForm.Comment}}</div>
						</van-collapse-item>
					</van-collapse>
				</van-tab>

				<van-tab title="现场测定" style="min-height: 520px;">
					<van-collapse v-model="SceneActive">
						<van-collapse-item v-for="(item,index) in SceneData" :name="index+1" :title="item.Key">
							<div>
								<van-field readonly clickable label="结果单位" :value="item.q[0].ValueUnitNname" placeholder="请选择" @click="ValueUnitPicker=true"
								 right-icon="arrow-down"></van-field>
								<van-popup v-model="ValueUnitPicker" round position="bottom">
									<van-picker show-toolbar :columns="unitAll" @cancel="ValueUnitPicker = false" @confirm="ValueUnitConfirm(index,$event)"></van-picker>
								</van-popup>

								<van-field readonly clickable label="检测方法及来源" :value="item.q[0].MethodName" placeholder="请选择" @click="scencmethodPicker=true"
								 right-icon="arrow-down"></van-field>
								<van-popup v-model="scencmethodPicker" round position="bottom">
									<van-picker show-toolbar :columns="sceneMethod[index]" @cancel="scencmethodPicker = false" @confirm="scencmethodConfirm(item,$event)"></van-picker>
								</van-popup>
							</div>
							<div>
								<van-field readonly clickable label="监测仪器名称、型号及编号(溯源信息)" :value="item.q[0].DeviceIdName" @click="showscencdevicem(item.q[0],index)"
								 right-icon="arrow-down"></van-field>
							</div>
							<div v-for="data in item.q" style="border:1px solid rgb(230,230,230);border-radius: 5px;">
								<van-field v-model="data.FrequecyNo" placeholder="1" label="频次" disabled type="digit"></van-field>
								<van-field v-model="data.Value" placeholder="分析结果" label="分析结果" type="number"></van-field>
								<van-field v-model="data.Description" placeholder="备注" label="备注" :maxlength="200" show-word-limit></van-field>
							</div>
						</van-collapse-item>
						<!-- 仪器选择 -->
						<van-popup closeable v-model="showscencdevice" position="bottom" :style="{ height: '100%' }">
							<div style="margin-top: 35px;">
								<van-search v-model="scencdevice_keyword" placeholder="请输入搜索关键词" />
							</div>
							<van-row>
								<van-col span="6">仪器名称</van-col>
								<van-col span="6">规格型号</van-col>
								<van-col span="6">仪器编号</van-col>
								<van-col span="6">溯源方式</van-col>
							</van-row>
							<van-row v-for="(item,index) in allDev" :style="index%2!=0?'background-color:#FFFFFF;':'background-color:#F7F8FA;'"
							 @click="deviceconfirm(item)">
								<van-col class="van-ellipsis" span="6">{{item.Name}}</van-col>
								<van-col class="van-ellipsis" span="6">{{item.Specification}}</van-col>
								<van-col class="van-ellipsis" span="6">{{item.DevCode}}</van-col>
								<van-col class="van-ellipsis" span="6">{{item.SourceWay}}</van-col>
							</van-row>
						</van-popup>
					</van-collapse>
				</van-tab>

				<van-tab title="采集图像" style="min-height: 520px;">
					<van-uploader v-model="fileList" style="margin-top: 20px;" @delete="onfiledel"></van-uploader>
				</van-tab>

				<van-tab title="分瓶信息" style="min-height: 520px;">
					<van-collapse v-model="activestand">
						<van-collapse-item v-for="(item,index) in standData" :name="index" :title="item.MonitemName">
							<van-field v-model="item.SamplingAmount" label="采样量"></van-field>
							<van-field v-model="item.Container" label="容器"></van-field>
							<van-field v-model="item.Count" placeholder="请输入用户名" label="瓶数"></van-field>
							<van-field v-model="item.SaveMehtod" placeholder="请输入保存方法" label="保存方法"></van-field>
							<div>
								<van-field readonly clickable label="分析地点" :value="item.AnalysisSite" @click="fxaddressPicker=true" right-icon="arrow-down"></van-field>
								<van-popup v-model="fxaddressPicker" round position="bottom">
									<van-picker show-toolbar :columns="fxaddress" @cancel="fxaddressPicker = false" @confirm="fxaddressConfirm(index,$event)"></van-picker>
								</van-popup>
							</div>
							<van-field v-model="item.UpdateTime" label="保存时间"></van-field>
							<van-field v-model="index" label="排序"></van-field>
						</van-collapse-item>
					</van-collapse>
				</van-tab>
				<van-tab title="打印预览" style="min-height: 520px;">
					<ul id="dowebok">
						<li v-for="(item,index) in projectPDF">
							<img style="width: 100%; height: 100%;" :src="common.IteamForServer(item)" :key="index" @click="imgShowTime" />
						</li>
					</ul>
				</van-tab>

				<van-tab title="企业信息" style="min-height: 520px;">
					<van-collapse v-model="activeNames">
						<van-collapse-item name="1" title="基本信息">
							<van-field v-model="PrivateData.ClientName" label="企业名称" disabled></van-field>
							<van-field v-model="PrivateData.ClientAdd" label="详细地址" disabled></van-field>
							<van-field v-model="example.longitude||0" label="经度" disabled></van-field>
							<van-field v-model="example.latitude||0" label="维度" disabled></van-field>
							<van-field v-model="projectdetail.RcvContact" label="联系人" disabled></van-field>
							<van-field v-model="projectdetail.RcvContactDetial" label="联系电话" disabled></van-field>
							<van-field v-model="example.administrative_regions" label="行政区域" disabled></van-field>
							<van-field v-model="example.control_level" label="控制级别" disabled></van-field>
							<van-field v-model="example.company_profile" label="企业简介" disabled></van-field>
							<van-field v-model="example.main_ingreadient" label="主要原料" disabled></van-field>
							<van-field v-model="example.main_accessories" label="主要辅料" disabled></van-field>
							<van-field v-model="example.main_products" label="主要产品" disabled></van-field>
							<van-field v-model="example.production_process" label="生产工艺" disabled></van-field>
							<van-field v-model="example.pollution_treatment_process" label="污染治理工艺" disabled></van-field>
						</van-collapse-item>
						<van-collapse-item name="2" title="扩展属性">
							<van-field v-model="example.extended_attributes" label="扩展属性" disabled></van-field>
						</van-collapse-item>
					</van-collapse>
				</van-tab>
			</van-tabs>

			<van-popup v-model="showsampmons" closeable position="bottom" :style="{ height: '100%' }" @opened="loadoptions">
				<van-divider>监测项目</van-divider>
				<van-checkbox-group v-model="example.mons_sele" style="width: 50%;display: inline-block;border-right: 1px solid rgb(240,240,240)">
					<van-divider>全部</van-divider>
					<div>
						<van-search v-model="example.key_left" placeholder="请输入搜索关键词" @search="example.allsearch(example.key_left)" />
					</div>
					<van-loading v-if="example.isloading" type="spinner" style="position: absolute;left: 80px;" color="#1989fa"></van-loading>
					<van-cell-group>
						<van-cell v-for="(item, index) in example.mons_all_search" clickable :key="item.Name" :title="item.Name" @click="mons_alltoggle(index,item)">
							<template #right-icon>
								<van-checkbox :name="item" ref="monscheckboxes" />
							</template>
						</van-cell>
					</van-cell-group>
				</van-checkbox-group>

				<van-checkbox-group v-model="example.mons_sele" style="width: 48%;display: inline-block;float: right;">
					<van-divider>已选</van-divider>
					<div>
						<van-search v-model="example.key_right" placeholder="请输入搜索关键词" />
					</div>
					<van-cell-group>
						<van-cell v-for="(item, index) in common.mons_sele_search(example.key_right)" clickable :key="item.Name" :title="item.Name"
						 @click="mons_seltoggle(index,item)">
							<template #right-icon>
								<van-checkbox :name="item" ref="monselscheckboxes" />
							</template>
						</van-cell>
					</van-cell-group>
				</van-checkbox-group>
			</van-popup>

			<div>
				<van-field readonly clickable label="采样人：" :value="common.samplinguserformat(SamplingUserSele)" required
				 placeholder="选择人员" @click="showSamplingUserPicker=true" right-icon="arrow-down"></van-field>

				<van-popup style="width: 100%;height: 50%;" v-model="showSamplingUserPicker" round position="bottom">
					<van-checkbox-group v-model="SamplingUserSele">
						<van-cell-group>
							<van-cell v-for="(item, index) in SamplingUserList" clickable :key="item" :title="`${item.Name}`" @click="SamplingUsertoggle(index)">
								<template #right-icon>
									<van-checkbox :name="item" ref="samplingUser" />
								</template>
							</van-cell>
						</van-cell-group>
					</van-checkbox-group>
				</van-popup>

				<van-field readonly clickable label="送样人：" :value="common.samplinguserformat(SendUserSele)" placeholder="选择人员"
				 @click="SendUserPicker=true" right-icon="arrow-down"></van-field>

				<van-popup style="width: 100%;height: 50%;" v-model="SendUserPicker" round position="bottom">
					<van-checkbox-group v-model="SendUserSele">
						<van-cell-group>
							<van-cell v-for="(item, index) in SamplingUserList" clickable :key="item" :title="`${item.Name}`" @click="SendUsertoggle(index)">
								<template #right-icon>
									<van-checkbox :name="item" ref="sendUser" />
								</template>
							</van-cell>
						</van-cell-group>
					</van-checkbox-group>
				</van-popup>


				<van-field readonly clickable label="校核审核：" :value="common.samplinguserformat(checkauditUserSele)" required
				 placeholder="选择人员" @click="checkauditPicker=true;" right-icon="arrow-down"></van-field>

				<van-popup style="width: 100%;height: 50%;" v-model="checkauditPicker" round position="bottom">
					<van-checkbox-group v-model="checkauditUserSele">
						<van-cell-group>
							<van-cell v-for="(item, index) in checkauditUserList" clickable :key="item" :title="`${item.Name}`" @click="checkaudittoggle(index)">
								<template #right-icon>
									<van-checkbox :name="item" ref="checkaudit" />
								</template>
							</van-cell>
						</van-cell-group>
					</van-checkbox-group>
				</van-popup>

				<van-field readonly clickable label="审核：" :value="common.samplinguserformat(verifyUserSele)" required placeholder="选择人员"
				 @click="verifyUserPicker=true" right-icon="arrow-down"></van-field>

				<van-popup style="width: 100%;height: 50%;" v-model="verifyUserPicker" round position="bottom">
					<van-checkbox-group v-model="verifyUserSele">
						<van-cell-group>
							<van-cell v-for="(item, index) in verifyUserList" clickable :key="item" :title="`${item.Name}`" @click="verifytoggle(index)">
								<template #right-icon>
									<van-checkbox :name="item" ref="verify" />
								</template>
							</van-cell>
						</van-cell-group>
					</van-checkbox-group>
				</van-popup>
			</div>
			<van-button @click="SaveBtn_Click">保存</van-button>
			<van-button @click="uploadBtn_Click">提交</van-button>
		</template>
	</div>

	<script>
		var vueData = {
			showSamplinginfo: false,
			tag: 'd877c7d5-6bb8-42d4-a79c-0f644e130a62',
			projectid: "323a4b58-8dab-4171-8636-741715227aee",
			activeNames: ['1', '2', '3', '4'],
			showOverlay: false,
			projectdetail: [],
			Montype: {},

			currentsampindex: 0,
			showSamplingcalendar: false,
			TagIds: [],
			showTagIdPicker: false,
			addresses: [{
				text: "请选择监测性质",
				disabled: true
			}],
			showAddressPicker: false,
			MethodIds: [],
			showMethodPicker: false,
			Weathers: ["晴天", "多云", "阴天", "小雨", "中雨", "暴雨", "雪天", "冰雹"],
			showWeatherPicker: false,
			AccessPipeNetwork: [{
				value: 1,
				text: "是"
			}, {
				value: 0,
				text: "否"
			}],
			show_AccessPipeNetwork_Picker: false,
			showBuildTimecalendar: false,
			SendSampTimePicker: false,
			addSaveWater: [{
				value: 0,
				text: "不添加保存剂"
			}, {
				value: 1,
				text: "添加保存剂"
			}],
			finished: true,
			loading: false,
			showSamplingUserPicker: false,
			SamplingUserNames: [],
			SendUserPicker: false,
			SendUsers: [],
			checkauditPicker: false,
			verifyUserPicker: false,
			CbSele: [],
			showCheckbox: false,
			sampDetail: [],
			SceneData: [],
			SceneActive: ['1'],
			sceneMethod: [],
			unitAll: [],
			ValueUnitNname: "",
			ValueUnitPicker: false,
			scencmethod: [],
			scencmethodPicker: false,
			scencdevice: [],
			showscencdevice: false,
			tabindex: 0,
			valueresult: 0,
			SampForm: [],
			PrivateData: [],
			fileList: [],
			FormFlows: [],
			activestand: ['1'],
			standData: [],
			numofcoll: 0,
			numofsamples: 0,
			fxaddress: ['实验室', '现场'],
			fxaddressPicker: false,
			fporder: 1,

			timeOutEvent: 0,

			SamplingUserList: [],
			SamplingUserSele: [],
			SendUserSele: [],

			checkauditUserList: [],
			checkauditUserSele: [],

			verifyUserList: [],
			verifyUserSele: [],
			sampId: 'ffa02e2c-8763-4d1b-bcf3-ef38b403a73b',

			//图像
			filedel: [],

			//预览
			allDev: [],
			projectPDF: [],

			//监测项目


			//采样详情
			issense: true,
			samplingObj: [],
			SamplingTimePicker: false,
			scencdevice_keyword: [],
			Device: [],

			currentTime: common.currenttime,
			SamplingCount: 0,
			PreservativePicker: false,
			Preservatives: ["是", "否"],
			IsComparePicker: false,
			IsCompares: [{
				text: '是',
				value: true
			}, {
				text: '否',
				value: false
			}],
			FormFlows: "",
			showsampmons: false,
			UploadFiles: [],
			//任务选择
			currentmonSele: [],
			samplingObjindex: "",
		};
		var vueMethod = {
			focus: function(e) {
				try {
					_t.fastKey.focusElem(e);
				} catch (e) {}
			}
		};
		var vueMounted = function() {
			this.init()
		}

		var myMethod = {
			init() {
				service.GetProjectDetail(this.projectid)
				service.LoadTag(this.projectid)
				service.LoadMethod(this.tag)
				service.GetSampDetail(this.sampId, '', false)
				service.GetPlanUsers(this.projectid)
				service.GetUsersbyCode('40004')
				service.GetUsersbyCodev('40005')
				service.GetunitAll()
			},

			gtouchstart: function(item) {
				timeOutEvent = setTimeout(function() {

				}, 300);
				return false;
			},
			gtouchend: function(item) {
				clearTimeout(timeOutEvent);
			},
			AddressConfirm(value) {
				this.SampForm.AddressId = value.value
				this.SampForm.AddressName = value.text
				this.showAddressPicker = false
			},
			MethodConfirm(value) {
				this.SampForm.MethodId = value.value
				this.SampForm.MethodName = value.text
				this.showMethodPicker = false
			},
			WeatherConfirm(value) {
				this.SampForm.Weather = value
				this.showWeatherPicker = false
			},
			AccessPipeNetworkConfirm(value) {
				this.PrivateData.AccessPipeNetwork = value.text
				this.show_AccessPipeNetwork_Picker = false
			},

			SamplingBeginTimeConfirm(value) {
				this.SampForm.SamplingTimeBegin = value.getFullYear() + "-" + (value.getMonth() + 1) + "-" + value.getDate()
				this.showSamplingcalendar = false
			},
			TagIdConfirm(value) {
				service.GetAllAddressForSamp('', 3, value.value, this.projectid)
				this.SampForm.TagName = value.text
				this.SampForm.TagId = value.value
				this.showTagIdPicker = false
			},
			BuildTimecalendarConfirm(value) {
				this.PrivateData.BuildTime = value.getFullYear() + "/" + (value.getMonth() + 1) + "/" + value.getDate()
				this.showBuildTimecalendar = false
			},
			SendSampTimeConfirm(value) {
				this.SampForm.SendSampTime = value.getFullYear() + "/" + (value.getMonth() + 1) + "/" + value.getDate()
				this.SendSampTimePicker = false
			},
			savewaterChange(value) {
				SaveWaterSele = value
			},
			keyleftSearch(value) {
				if (value) {
					this.SamplingTypeleft = this.SamplingTypeall_t
				}
				this.SamplingTypeleft = this.SamplingTypeall_t.filter(s => {
					return s.toString().includes(value)
				})
			},
			keyrightSearch(value) {

			},
			toSmapInfo(item, index) {
				this.samplingObj = item
				this.samplingObjindex = index
				service.samplinginfoInit()
				this.showSamplinginfo = true
			},
			ValueUnitConfirm(index, value) {
				this.SceneData[index].q[0].ValueUnit = value.value
				this.SceneData[index].q[0].ValueUnitNname = value.text
				this.ValueUnitPicker = false
			},
			scencmethodConfirm(item, index) {
				item.q[0].MethodId = index.value
				item.q[0].MethodName = index.text


				this.scencmethodPicker = false
			},
			fxaddressConfirm(index, value) {
				this.standData[index].AnalysisSite = value
				this.fxaddressPicker = false
			},
			createSamp() {
				this.sampDetail.push({
					Mons: [],
					Row: {
						AddTime: null,
						AddressName: "大丰水厂（地表水）",
						AddresssId: "a2c7e40d-aef1-444b-80b7-725aa3999c6e",
						AnasysTime: null,
						Description: null,
						DeviceId: null,
						DeviceIdName: null,
						Extend1: null,
						Extend2: null,
						Extend3: null,
						FrequecyNo: 1,
						Id: null,
						IsCompare: false,
						IsLowLD: null,
						IsSenceAnalysis: false,
						LD: null,
						LDUnitId: null,
						LDUnitName: null,
						MethodId: null,
						MethodName: null,
						MonitemId: "44dc0dc7-0e18-884a-b9eb-affd689e4bcb",
						MonitemName: "化学需氧量",
						OrderIndex: 1,
						Preservative: "否",
						PrivateData: null,
						ProjectId: "8ae1394e-ab42-474d-a190-13b444561b45",
						QrCode: null,
						RelationId: null,
						RelationValue: null,
						RelationValueUnit: null,
						RelationValueUnitName: null,
						SampStandId: null,
						SampingCode: null,
						SampleAcceptance: null,
						SampleCollection: null,
						SamplingCount: 3,
						SamplingId: null,
						SamplingTime: null,
						SamplingType: 0,
						SeriesCnt: null,
						ShowSampingCode: null,
						TransferCode: null,
						UpdateTime: null,
						Value: null,
						Value1: null,
						Value2: null,
						Value3: null,
						Value4: null,
						Value5: null,
						ValueUnit: null,
						ValueUnit1: null,
						ValueUnit3: null,
						ValueUnitNname: null,
						Version: 0,
						valueUnit1Name: null,
						valueUnit2: null,
						valueUnit2Name: null,
						valueUnit3Name: null,
					},
					sampling: [],
					samplingsence: []
				})
			},
			tagformat(tid) {
				console.log(tid)
			},
			SamplingUsertoggle(index) {
				this.$refs.samplingUser[index].toggle()
			},
			SendUsertoggle(index) {
				this.$refs.sendUser[index].toggle()
			},
			checkaudittoggle(index) {
				this.$refs.checkaudit[index].toggle()
			},
			verifytoggle(index) {
				this.$refs.verify[index].toggle()
			},
			//采样详情
			SamplingTimeConfirm(value) {
				this.samplingObj.Row.SamplingTime = value
				this.SamplingTimePicker = false
			},
			PreservativeConfirm() {

			},
			IsCompareConfirm() {

			},
			showscencdevicem(item, index) {
				this.currentsampindex = index
				this.showscencdevice = true
				service.GetDevices(item.MethodId, 1, 150);
			},
			tomonpicker(obj, issence) {
				var monsele = []
				obj.Mons.forEach(function(item) {
					if (issence == item.IsSence) {
						monsele.push(item)
					}
				})
				var nobj = {
					data: monsele,
					sence: issence
				}
				this.currentmonSele = nobj
				this.showsampmons = true
			},
			deviceconfirm(item) {
				this.SceneData[this.currentsampindex].q.forEach(function(data) {
					data.DeviceId = item.Id,
						data.DeviceIdName = item.Name + item.Specification + "(" + item.DevCode + ")(" + item.SourceWay + (item.SourceDate
							.split(' '))[0] + ")"
				})
				this.showscencdevice = false
			},
			loadoptions() {
				service.GetMonsByTagId("d877c7d5-6bb8-42d4-a79c-0f644e130a62")
				example.mons_sele_search = example.mons_sele
			},
			onfiledel(file) {
				if (file.Id) {
					this.filedel.push(file.Id)
				}
			},
			SaveBtn_Click() {
				if (!this.sampupdate()) {
					//这里提示
					this.$toast('请填写必填选项');
					return false;
				}
				var saveresult = {
					IsAdd: false,
					IsSubmit: false,
					SampForm: this.SampForm,
					UploadFiles: vueData.UploadFiles,
					DelFiles: this.filedel
				}
				console.log(saveresult);
				service.SaveSamp(JSON.stringify(saveresult))
			},
			sampupdate() {
				//这里是校验
				if (vueData.SampForm.SamplingTimeBegin.length == 0 || vueData.SampForm.TagName.length == 0 || vueData.SampForm.AddressName
					.length == 0 ||
					vueData.SamplingUserSele.length == 0 || vueData.checkauditUserSele.length == 0 || vueData.verifyUserSele.length ==
					0) {
					return false;
				}
				//这里是校验 有没有现场测定的
				for (var item in vueData.SceneData) {
					var ite = vueData.SceneData[item].q[0];
					if (ite.ValueUnit.length == 0) {
						return false;
					}
				}
				var SamplingFormStands = []
				var _this = this
				this.sampDetail.forEach(function(item, index) {
					item.Mons.forEach(function(item1, index1) {
						let isSence = item1.IsSence || false
						let SampStandId = _this.getGuid() //item.Row.SampStandId||
						if (!isSence) {
							SamplingFormStands.push({
								SamplingId: _this.SamplingId,
								IsSenceAnalysis: isSence,
								SampStandId: SampStandId,
								MonitemId: item1.MonitemId,
								MonitemName: item1.MonitemName,
								SampingCode: item.Row.SampingCode,
								AddresssId: item.Row.AddresssId,
								AddressName: item.Row.AddressName,
								OrderIndex: index + 1,
								FrequecyNo: index + 1,
								SamplingTime: item.Row.SamplingTime,
								SamplingType: item.Row.SamplingType,
								SamplingCount: item.Row.SamplingCount,
								Preservative: item.Row.Preservative,
								IsCompare: item.Row.IsCompare,
								SampleCollection: item.Row.SampleCollection,
								SampleAcceptance: item.Row.SampleAcceptance,
								Description: item.Row.Description
							})
						}
					})
				})
				this.SceneData.forEach(function(item, index) {
					let SampStandId = _this.getGuid()
					item.q.forEach(function(item1) {
						SamplingFormStands.push({
							SamplingId: _this.SceneData[0].q[0].SamplingId,
							ProjectId: vueData.projectid,
							IsSenceAnalysis: true,
							SampStandId: _this.getGuid(),
							MonitemId: item1.MonitemId,
							MonitemName: item1.MonitemName,
							SampingCode: item1.SampingCode,
							AddresssId: item1.AddresssId,
							AddressName: item1.AddressName,
							OrderIndex: item1.OrderIndex + "",
							FrequecyNo: item1.FrequecyNo + "",
							SamplingTime: item1.SamplingTime,
							SamplingType: item1.SamplingType,
							SamplingCount: item1.SamplingCount + "",
							Preservative: item1.Preservative,
							IsCompare: item1.IsCompare,
							SampleCollection: item1.SampleCollection,
							SampleAcceptance: item1.SampleAcceptance,
							Description: item1.Description,
							Value: item1.Value,
							ValueUnitNname: item.q[0].ValueUnitNname,
							ValueUnit1Name: item.q[0].ValueUnitNname,
							ValueUnit2Name: item.q[0].ValueUnitNname,
							ValueUnit3Name: item.q[0].ValueUnitNname,
							ValueUnit: item.q[0].ValueUnit,
							ValueUnit1: item.q[0].ValueUnit,
							ValueUnit2: item.q[0].ValueUnit,
							ValueUnit3: item.q[0].ValueUnit,
							MethodId: item.q[0].MethodId,
							DeviceId: item1.DeviceId,
							MethodName: item.q[0].MethodName,
							DeviceIdName: item1.DeviceIdName,
						})
					})
				})

				this.SampForm.SamplingDetails = SamplingFormStands
				var time = new Date()
				this.SampForm.UpdateTime = time.getFullYear() + "-0" + (time.getMonth() + 1) + "-0" + time.getDate() + " " + time.getHours() +
					":" + time.getMinutes() + ":" + time.getSeconds()
				this.SampForm.PrivateData = JSON.stringify(this.PrivateData)
				this.SampForm.ReciveTime = ""
				Vue.set(this.SampForm, "ProjectNo", vueData.projectdetail.ProjectInfo.ProjectNo)
				this.SceneData.forEach(function(item, index) {
					Vue.set(_this.SampForm, item.Key, "")
				})
				//文件
				Vue.set(this.SampForm, "file", "")
				Vue.set(this.SampForm, "IsEnableSign", "")

				//非现场
				var standData = []
				this.standData.forEach(function(item, index) {
					standData.push({
						StandNo: item.StandNo,
						MonitemIds: item.MonitemIds,
						MonitemName: item.MonitemName,
						SamplingAmount: item.SamplingAmount,
						AnalysisSite: item.AnalysisSite,
						SaveMehtod: item.SaveMehtod,
						Preservative: item.Preservative,
						Count: item.Count + "",
						Container: item.Container,
						SaveTimes: item.SaveTimes,
						Index: item.Index + "",
						Id: item.Id,
						MonItems: [item.MonitemIds],
					})
				})
				this.SampForm.SamplingFormStands = standData

				//采样人员
				this.SampForm.SamplingUserName = ""
				this.SampForm.SamplingUserId = ""
				this.SamplingUserSele.forEach(function(item) {
					_this.SampForm.SamplingUserName += item.Name + ","
					_this.SampForm.SamplingUserId += item.Id + ","
				})
				this.SampForm.SamplingUserName = this.SampForm.SamplingUserName.substring(0, this.SampForm.SamplingUserName.length -
					1)
				this.SampForm.SamplingUserId = this.SampForm.SamplingUserId.substring(0, this.SampForm.SamplingUserId.length - 1)
				var FormFlows = JSON.parse(this.SampForm.FormFlows)
				SendUser = this.update_FormFlows(FormFlows[0].FlowUserIds, FormFlows[0].FlowUserNames, this.SendUserSele)
				FormFlows[0].FlowUserNames = SendUser.Name
				FormFlows[0].FlowUserIds = SendUser.Id
				checkauditUser = this.update_FormFlows(FormFlows[1].FlowUserIds, FormFlows[1].FlowUserNames, this.checkauditUserSele)
				FormFlows[1].FlowUserNames = checkauditUser.Name
				FormFlows[1].FlowUserIds = checkauditUser.Id
				verifyUser = this.update_FormFlows(FormFlows[2].FlowUserIds, FormFlows[2].FlowUserNames, this.verifyUserSele)
				FormFlows[2].FlowUserNames = verifyUser.Name
				FormFlows[2].FlowUserIds = verifyUser.Id
				this.SampForm.FormFlows = JSON.stringify(FormFlows)
				this.fileList.forEach(function(item) {
					if (!item.Id) {
						service.UploadFile(item) //异步
					}
				})
				return true;
			},
			update_FormFlows(Uid, Uname, Source) {
				Uid = ""
				Uname = ""
				Source.forEach(function(item) {
					Uname += item.Name + ","
					Uid += item.Id + ","
				})
				Uname = Uname.substring(0, Uname.length - 1)
				Uid = Uid.substring(0, Uid.length - 1)
				return {
					Id: Uid,
					Name: Uname
				}
			},
			uploadBtn_Click() {
				if (!this.sampupdate()) {
					//这里提示
					alert("请填写必填选项");
					return false;
				}
				var saveresult = {
					IsAdd: false,
					IsSubmit: true,
					SampForm: this.SampForm,
					UploadFiles: vueData.UploadFiles,
					DelFiles: this.filedel
				}
				console.log(saveresult);
				service.SaveSamp(saveresult)
			},
			mons_alltoggle(index, item) {
				if (!this.$refs.monscheckboxes[index].checked) {
					example.AddSele(item)
				} else {
					example.delSele(item)
				}

				this.$refs.monscheckboxes[index].toggle()
			},
			mons_seltoggle(index, item) {
				example.delSele(item)
				this.$refs.monselscheckboxes[index].toggle()
			},
			getGuid() {
				var guid = "";
				for (var i = 1; i <= 32; i++) {
					var n = Math.floor(Math.random() * 16.0).toString(16)
					guid += n
					if (i == 8 || i == 12 || i == 16 || i == 20) {
						guid += "-"
					}
				}
				return guid;
			},
			SampLingImgLoad(eve) {
				if (eve == 4) {
					service.GetSamplingImg(vueData.SampForm.Id);
				}
			},
			imgShowTime() {
				var viewer = new Viewer(document.getElementById('dowebok'));
			},
		}
		for (var key in myMethod) {
			vueMethod[key] = myMethod[key];
		}
		var myMounted = null
		if (myMounted != null) {
			vueMounted = myMounted;
		}
		var myData = {}
		/*把您定义的数据覆盖布局器自动识别的变量,考虑到兼容性，请下载查看head中重写的assign方法*/
		Object.assign(vueData, myData);
		var _t = this;
		var Ctor = Vue.extend({
			//提前绑定的变量
			data: function() {
				return vueData;
			},
			//页面加载完 会执行方法 可以做一些初始化操作
			mounted: vueMounted,
			/*当前页面绑定的方法集合 与布局器节点一一映射即可 参照element ui文档*/
			methods: vueMethod
		});
		new Ctor().$mount('#magicalDragScene');
		//echarts自动初始化
		new McECharts().render();
	</script>
</body>
</html>
